		<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <ext:ResourceManager ID="ResourceManagerProxy1" runat="server">
    </ext:ResourceManager>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <ext:Viewport ID="ViewPort1" runat="server" Layout="fit">
        <Items>
            <ext:FormPanel ID="pnlAddOrder" runat="server" Title="新增order信息" Frame="true" ButtonAlign="Center">
                <Items>
										    <ext:Container runat="server" Layout="HBoxLayout" Height="28">
                        <LayoutConfig>
                            <ext:HBoxLayoutConfig Align="Stretch" />
                        </LayoutConfig>
                        <Items>
						<ext:TextField id="txtId" runat="server" FieldLabel="ID" AllowBlank="False" BlankText="请输入ID！"   Padding="2" Flex="1"  /> 
                        </Items>
                    </ext:Container>
    <ext:Container runat="server" Layout="HBoxLayout" Height="28">
                        <LayoutConfig>
                            <ext:HBoxLayoutConfig Align="Stretch" />
                        </LayoutConfig>
                        <Items>
						<ext:TextField id="txtUserId" runat="server" FieldLabel="UserId"  Padding="2" Flex="1"  /> 
                        </Items>
                    </ext:Container>
    <ext:Container runat="server" Layout="HBoxLayout" Height="28">
                        <LayoutConfig>
                            <ext:HBoxLayoutConfig Align="Stretch" />
                        </LayoutConfig>
                        <Items>
						<ext:TextField id="txtUserName" runat="server" FieldLabel="UserName"  Padding="2" Flex="1"  /> 
                        </Items>
                    </ext:Container>
    <ext:Container runat="server" Layout="HBoxLayout" Height="28">
                        <LayoutConfig>
                            <ext:HBoxLayoutConfig Align="Stretch" />
                        </LayoutConfig>
                        <Items>
						<ext:TextField id="txtShipAddress" runat="server" FieldLabel="ShipAddress"  Padding="2" Flex="1"  /> 
                        </Items>
                    </ext:Container>
    <ext:Container runat="server" Layout="HBoxLayout" Height="28">
                        <LayoutConfig>
                            <ext:HBoxLayoutConfig Align="Stretch" />
                        </LayoutConfig>
                        <Items>
						<ext:TextField id="txtOrderDate" runat="server" FieldLabel="OrderDate"  Padding="2" Flex="1"  /> 
                        </Items>
                    </ext:Container>
    <ext:Container runat="server" Layout="HBoxLayout" Height="28">
                        <LayoutConfig>
                            <ext:HBoxLayoutConfig Align="Stretch" />
                        </LayoutConfig>
                        <Items>
						<ext:TextField id="txtOrderStatus" runat="server" FieldLabel="OrderStatus"  Padding="2" Flex="1"  /> 
                        </Items>
                    </ext:Container>
    <ext:Container runat="server" Layout="HBoxLayout" Height="28">
                        <LayoutConfig>
                            <ext:HBoxLayoutConfig Align="Stretch" />
                        </LayoutConfig>
                        <Items>
						<ext:TextField id="txtCloseDate" runat="server" FieldLabel="CloseDate"  Padding="2" Flex="1"  /> 
                        </Items>
                    </ext:Container>
    <ext:Container runat="server" Layout="HBoxLayout" Height="28">
                        <LayoutConfig>
                            <ext:HBoxLayoutConfig Align="Stretch" />
                        </LayoutConfig>
                        <Items>
						<ext:TextField id="txtOrderTotalAmount" runat="server" FieldLabel="OrderTotalAmount"  Padding="2" Flex="1"  /> 
                        </Items>
                    </ext:Container>
    <ext:Container runat="server" Layout="HBoxLayout" Height="28">
                        <LayoutConfig>
                            <ext:HBoxLayoutConfig Align="Stretch" />
                        </LayoutConfig>
                        <Items>
						<ext:TextField id="txtVoucherFree" runat="server" FieldLabel="VoucherFree"  Padding="2" Flex="1"  /> 
                        </Items>
                    </ext:Container>
    <ext:Container runat="server" Layout="HBoxLayout" Height="28">
                        <LayoutConfig>
                            <ext:HBoxLayoutConfig Align="Stretch" />
                        </LayoutConfig>
                        <Items>
						<ext:TextField id="txtShippingFree" runat="server" FieldLabel="ShippingFree"  Padding="2" Flex="1"  /> 
                        </Items>
                    </ext:Container>
    <ext:Container runat="server" Layout="HBoxLayout" Height="28">
                        <LayoutConfig>
                            <ext:HBoxLayoutConfig Align="Stretch" />
                        </LayoutConfig>
                        <Items>
						<ext:TextField id="txtOrderPayAmount" runat="server" FieldLabel="OrderPayAmount"  Padding="2" Flex="1"  /> 
                        </Items>
                    </ext:Container>
    <ext:Container runat="server" Layout="HBoxLayout" Height="28">
                        <LayoutConfig>
                            <ext:HBoxLayoutConfig Align="Stretch" />
                        </LayoutConfig>
                        <Items>
						<ext:TextField id="txtIsPay" runat="server" FieldLabel="IsPay"  Padding="2" Flex="1"  /> 
                        </Items>
                    </ext:Container>
    <ext:Container runat="server" Layout="HBoxLayout" Height="28">
                        <LayoutConfig>
                            <ext:HBoxLayoutConfig Align="Stretch" />
                        </LayoutConfig>
                        <Items>
						<ext:TextField id="txtPayDate" runat="server" FieldLabel="PayDate"  Padding="2" Flex="1"  /> 
                        </Items>
                    </ext:Container>
    <ext:Container runat="server" Layout="HBoxLayout" Height="28">
                        <LayoutConfig>
                            <ext:HBoxLayoutConfig Align="Stretch" />
                        </LayoutConfig>
                        <Items>
						<ext:TextField id="txtIsClose" runat="server" FieldLabel="IsClose"  Padding="2" Flex="1"  /> 
                        </Items>
                    </ext:Container>
    <ext:Container runat="server" Layout="HBoxLayout" Height="28">
                        <LayoutConfig>
                            <ext:HBoxLayoutConfig Align="Stretch" />
                        </LayoutConfig>
                        <Items>
						<ext:TextField id="txtIsShip" runat="server" FieldLabel="IsShip"  Padding="2" Flex="1"  /> 
                        </Items>
                    </ext:Container>
    <ext:Container runat="server" Layout="HBoxLayout" Height="28">
                        <LayoutConfig>
                            <ext:HBoxLayoutConfig Align="Stretch" />
                        </LayoutConfig>
                        <Items>
						<ext:TextField id="txtShipDate" runat="server" FieldLabel="ShipDate"  Padding="2" Flex="1"  /> 
                        </Items>
                    </ext:Container>
    <ext:Container runat="server" Layout="HBoxLayout" Height="28">
                        <LayoutConfig>
                            <ext:HBoxLayoutConfig Align="Stretch" />
                        </LayoutConfig>
                        <Items>
						<ext:TextField id="txtRecieveDate" runat="server" FieldLabel="RecieveDate"  Padding="2" Flex="1"  /> 
                        </Items>
                    </ext:Container>
    <ext:Container runat="server" Layout="HBoxLayout" Height="28">
                        <LayoutConfig>
                            <ext:HBoxLayoutConfig Align="Stretch" />
                        </LayoutConfig>
                        <Items>
						<ext:TextField id="txtIsRecieve" runat="server" FieldLabel="IsRecieve"  Padding="2" Flex="1"  /> 
                        </Items>
                    </ext:Container>
    <ext:Container runat="server" Layout="HBoxLayout" Height="28">
                        <LayoutConfig>
                            <ext:HBoxLayoutConfig Align="Stretch" />
                        </LayoutConfig>
                        <Items>
						<ext:TextField id="txtShipType" runat="server" FieldLabel="ShipType"  Padding="2" Flex="1"  /> 
                        </Items>
                    </ext:Container>
    <ext:Container runat="server" Layout="HBoxLayout" Height="28">
                        <LayoutConfig>
                            <ext:HBoxLayoutConfig Align="Stretch" />
                        </LayoutConfig>
                        <Items>
						<ext:TextField id="txtShipNo" runat="server" FieldLabel="ShipNo"  Padding="2" Flex="1"  /> 
                        </Items>
                    </ext:Container>

                </Items>
                <Buttons>
                    <ext:Button runat="server" Text="保存"  Icon="Accept">
                        <DirectEvents>
                            <Click Before="if(!#{pnlAddOrder}.getForm().isValid()) return false;" OnEvent="btnAddOrder_Click"
                                Success="#{pnlAddOrder}.getForm().reset();parent.ShowMessage('操作成功','添加order成功！',1);parent.RefreshOrderData();parent.CloseAddOrder(); "
                                 Failure="Ext.Msg.alert('操作失败', result.errorMessage);">
                                <EventMask ShowMask="true" Msg="数据保存中,请稍等....." />
                            </Click>
                        </DirectEvents>
                    </ext:Button>
                    <ext:Button runat="server" Text="取消" Icon="Decline">
                        <Listeners>
                            <Click Handler="parent.CloseAddOrder();"></Click>
                        </Listeners>
                    </ext:Button>
                </Buttons>
            </ext:FormPanel>
        </Items>
    </ext:Viewport>
</asp:Content>

	    protected void Page_Load(object sender, EventArgs e)
        {
            if (X.IsAjaxRequest)
                return;
 
        }

        protected void btnAddOrder_Click(object sender, DirectEventArgs e)
        {
            try
            {
                Order newOrder = new Order();

                
										   newOrder.Id = this.txtId.Text.Trim();
   newOrder.UserId = this.txtUserId.Text.Trim();
   newOrder.UserName = this.txtUserName.Text.Trim();
   newOrder.ShipAddress = this.txtShipAddress.Text.Trim();
   newOrder.OrderDate = this.txtOrderDate.Text.Trim();
   newOrder.OrderStatus = this.txtOrderStatus.Text.Trim();
   newOrder.CloseDate = this.txtCloseDate.Text.Trim();
   newOrder.OrderTotalAmount = this.txtOrderTotalAmount.Text.Trim();
   newOrder.VoucherFree = this.txtVoucherFree.Text.Trim();
   newOrder.ShippingFree = this.txtShippingFree.Text.Trim();
   newOrder.OrderPayAmount = this.txtOrderPayAmount.Text.Trim();
   newOrder.IsPay = this.txtIsPay.Text.Trim();
   newOrder.PayDate = this.txtPayDate.Text.Trim();
   newOrder.IsClose = this.txtIsClose.Text.Trim();
   newOrder.IsShip = this.txtIsShip.Text.Trim();
   newOrder.ShipDate = this.txtShipDate.Text.Trim();
   newOrder.RecieveDate = this.txtRecieveDate.Text.Trim();
   newOrder.IsRecieve = this.txtIsRecieve.Text.Trim();
   newOrder.ShipType = this.txtShipType.Text.Trim();
   newOrder.ShipNo = this.txtShipNo.Text.Trim();



                Global.CurrentServiceContainer.OrderServiceProxy.Insert(newOrder);
 
                ResourceManager.AjaxSuccess = true;
 
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess = false;
                ResourceManager.AjaxErrorMessage = "Error Message:" + ex.Message;
            }

        } 
			
